package com.mei.allpowerfuladapter;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;

import com.mei.allpowerfuladapter.bean.Bean;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends Activity {

//    private MyAdapterWithCommonViewHolder adapter;
    private MyCommonAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initDatas();
        initViews();
    }

    private void initDatas(){
        List<Bean> datas=new ArrayList<Bean>(){
            {
                add(new Bean("标题1","内容1","2015-9-23","15649024562"));
                add(new Bean("标题2","内容2","2015-9-24","15649024563"));
                add(new Bean("标题3","内容3","2015-9-25","15649024564"));
                add(new Bean("标题4","内容4","2015-9-26","15649024565"));
                add(new Bean("标题5","内容5","2015-9-27","15649024566"));
                add(new Bean("标题6","内容6","2015-9-27","15649024566"));
                add(new Bean("标题7","内容7","2015-9-27","15649024566"));
                add(new Bean("标题8","内容8","2015-9-27","15649024566"));
            }
        };
//        adapter=new MyAdapterWithCommonViewHolder(this,datas);
        adapter=new MyCommonAdapter(this,datas);
    }

    private void initViews(){
        ListView listView = (ListView) findViewById(R.id.lv_list);
        listView.setAdapter(adapter);
    }
}
